package com.vesus.springclouddruid.controller;

import com.vesus.springclouddruid.model.User;
import com.vesus.springclouddruid.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    UserService userService ;

    @Value("${jdbc.username}")
    String username;

    @RequestMapping(value = "/name")
    public String hi(){
        return username;
    }

    @RequestMapping(value = "/userlist")
    public List<User> getUserList(){
        return userService.findAll() ;
    }
}
